const getters = {
  getPlayStatus(state) {
    return state.isPlayed
  },
  getMsg(state) {
    return state.isPlayed ? '播放' : '停止'
  },
  // 获取购物车的商品数量
  getProdCount(state) {
    return state.cart.length
  },
  // 统计购物车的商品总价格
  getProdSum(state) {
    let cart = state.cart;
    let sum = 0;
    cart.forEach(item => {
      sum += item.price * item.quantity
    });
    return sum*100
  }
}

export default getters